home *** CD-ROM | disk | FTP | other *** search
- /* *********************************************************************************
-
- FILE: MenuUpdate.c
-
- DESCRIPTION: Update Menus uses the unused space on the menu bar to display
- the three parameters: 'x' (center x location), 'y' (center y
- location), 'res'(resolution) and time through each major loop.
- Uses 'sprintf' from 'stdio' and 'CtoPstr' to do all the
- formating and conversions. This requires either the ANSI or
- ANSI881 libraries. This seems like a lot of baggage to carry
- around, but I got tired of trying extract out just the necessary
- string processing pieces. I turned off pointer checking for this
- compile because I also got tired of looking for the proper way
- to get sprintf to work with a declaration of Str255 for str1
- (which is necessary to keep the application from crashing).
-
- AUTHOR: Bruce E. Gladstone
-
- Copyright © 1990 by Bruce E. Gladstone, All Rights Reserved.
-
- Revision History:
- ============================================================
- 5/1/90 - Release to Compuserve
- ============================================================
-
- COMMENTS:
-
- None.
-
- ******************************************************************************** */
-
- #include <stdio.h>
- #include <MacTypes.h>
- #include <WindowMgr.h>
- #include <MenuMgr.h>
- #include <EventMgr.h>
- #include <ToolboxUtil.h>
- #include <ControlMgr.h>
- #include <color.h>
- #include <colortoolbox.h>
- #include "Mandelbrot.h"
-
-
- /* ---------------------------- Global Variables ---------------------------------- */
-
- extern int colorQD;
- extern int quitFlag;
- extern int linearFlag;
- extern int custPict;
- extern int numColorBits;
- extern int numColors, brushSize;
- extern int limit;
- extern int n;
- extern long startTime, now;
- extern float res;
- extern float centx, centy;
- extern float xmin, xmax, ymin, ymax;
- extern float delx, dely;
-
- /* ---------------------------- Global MacTypes ----------------------------------- */
-
- extern Str255 str;
- extern CTabHandle myColorHandle;
- extern RGBColor aColor;
- extern Rect myRect, dragRect;
- extern WindowPtr aboutWindow;
- extern MenuHandle appleMenu, mandelMenu, editMenu, xMenu, yMenu, resMenu, timeMenu;
- extern WindowPtr myWindow;
-
- /* --------------------------- Local Prototypes --------------------------------- */
-
- void updateMenus ( void );
- void CtoPstr ( char * );
-
- /* --------------------------------------------------------------------------------
- updateMenus - 5/01/90 beg
- -------------------------------------------------------------------------------- */
-
- void
- updateMenus()
- {
- Str255 str1;
-
- DeleteMenu ( xID );
- DeleteMenu ( yID );
- DeleteMenu ( resID );
- DeleteMenu ( timeID );
- DisposeMenu ( xMenu );
- DisposeMenu ( yMenu );
- DisposeMenu ( resMenu );
- DisposeMenu ( timeMenu );
-
- sprintf ( str1, "X = %1.6f", centx );
- CtoPstr ( str1 );
- xMenu = NewMenu ( xID, str1 );
-
- sprintf ( str1, "Y = %1.6f", centy );
- CtoPstr ( str1 );
- yMenu = NewMenu ( yID, str1 );
-
- sprintf ( str1, "Res = %1.6f", res );
- CtoPstr ( str1 );
- resMenu = NewMenu ( resID, str1 );
-
- sprintf ( str1, "Time = %4ld", now );
- CtoPstr ( str1 );
- timeMenu = NewMenu ( timeID, str1 );
-
- InsertMenu ( xMenu, 0 );
- InsertMenu ( yMenu, 0 );
- InsertMenu ( resMenu, 0 );
- InsertMenu ( timeMenu, 0 );
- DrawMenuBar ();
- } /* updateMenus() */
-
- /* =============================== EOF ==========================================
- Copyright © 1990 by Bruce E. Gladstone, All Rights Reserved.
- ================================================================================ */
-
-
-